/**
	Industry Watch Javascript Menu settings.

	Author:	Sandip Bhattacharya (sandipkb@yahoo.com)
*/
function createjsDOMenu(arrSettings){

	// main settings menu
	var mainMenu = new jsDOMenu(200);

	//add the save settings menu.

	with(mainMenu){
		addMenuItem(new menuItem("Save Setting", "","code:saveSettings(document.frm)"));
		addMenuItem(new menuItem("-", "",""));
	}


	if(arrSettings != null){
		for(var i=0;i<arrSettings.length;i++){
			with (mainMenu) {
				addMenuItem(new menuItem(arrSettings[i].stateName, "item" + i, "code:restoreState(" +  i + ")"));
			}

			settingsSubMenu = new jsDOMenu(150);
			with (settingsSubMenu) {
				addMenuItem(new menuItem("Rename", "", "code:renameState(" + arrSettings[i].iwUserSettingsId +",'" + arrSettings[i].stateName + "')"));
				addMenuItem(new menuItem("Delete", "", "code:deleteState(" + arrSettings[i].iwUserSettingsId +",'" + arrSettings[i].stateName + "')"));
			}

			mainMenu.items["item" + i].setSubMenu(settingsSubMenu); //ASSOCIATE SUB MENU WITH PARENT MENU ITEM
		}
	}

	// For licence terms, password change etc.
	var helpMenu = new jsDOMenu(210);
	with(helpMenu){
		addMenuItem(new menuItem("Obtaining Data for a Single Sector", "","code:openInNewWindow('iwservice/example-1.htm')"));
		addMenuItem(new menuItem("Obtaining a Detailed Sector Report", "","code:openInNewWindow('iwservice/example-2.htm')"));
		addMenuItem(new menuItem("Graphing Data of Interest", "","code:openInNewWindow('iwservice/example-3.htm')"));
		addMenuItem(new menuItem("Comparisons Between Sectors", "","code:openInNewWindow('iwservice/example-4.htm')"));
		addMenuItem(new menuItem("Creating a Bookmark", "","code:openInNewWindow('iwservice/example-5.htm')"));
		addMenuItem(new menuItem("-", "",""));
		addMenuItem(new menuItem("Change Password", "","iwChangePassword.jsp"));
		addMenuItem(new menuItem("-", "",""));
		addMenuItem(new menuItem("Manual (PDF)", "","code:openInNewWindow('iwManual.pdf')"));
		addMenuItem(new menuItem("Licence Terms & Conditions (PDF)", "","code:openInNewWindow('iwLicenceTerms.pdf')"));
	}

	var menuBar = new jsDOMenuBar("static", "staticMenuBar", "", "",200); //CREATE MAIN MENU ITEMS
	with (menuBar) {
		addMenuBarItem(new menuBarItem(":: Bookmarks", mainMenu));
		addMenuBarItem(new menuBarItem(":: Help", helpMenu));
		addMenuBarItem(new menuBarItem(":: Log Out",null,"",true,"code:logoutIWUser(document.frm)"));
	}
}